home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Programming Languages Suite
/
ProgLangD.iso
/
Borland Visual dBASE Professiona v7.0
/
DATA1.CAB
/
Sample_dBASE
/
Fleet
/
Ftree.wfm
< prev
next >
Wrap
Text File
|
1997-11-20
|
10KB
|
366 lines
//--------------------------------------------------------------
//
// Ftree.wfm -- Tree View of the flight schedule.
//
// This form builds a tree view of the flight schedule and
// organizes the schedule by aircraft, flight and scheduled
// dates. The tree view can show 1 day, 1 week or 1 month of
// schedule information. The default view is 1 week.
//
// Dependencies: SCHEDULE.DMD
// FLEET.CFM
// FLIGHT.ICO
// FLEET.ICO
// CLOCK.ICO
//
// Visual dBASE Samples Group
//
// $Revision: 1.11 $
//
// Copyright (c) 1997, Borland International, Inc.
// All rights reserved.
//
//--------------------------------------------------------------
SET TALK OFF
** END HEADER -- do not remove this line
//
// Generated on 11/02/97
//
parameter bModal
local f
f = new ftreeForm()
if (bModal)
f.mdi = false // ensure not MDI
f.readModal()
else
f.open()
endif
class ftreeForm of FLEETCFORM from "FLEET.CFM"
with (this)
open = class::FORM_OPEN
scaleFontSize = 8
height = 18
left = 10
top = 1
width = 59
text = "Fleet Tree"
endwith
this.DMCONNECT = new DATAMODREF()
this.DMCONNECT.parent = this
with (this.DMCONNECT)
filename = "FCONNECT.DMD"
dataModClass = "FConnectDataModule"
share = 0
active = true
left = 0
top = 0
endwith
this.QFTREE = new QUERY()
this.QFTREE.parent = this
with (this.QFTREE)
left = -0.1429
top = -0.0455
database = form.DMCONNECT.ref.dbfleet
sql = "@ftree.sql"
active = true
endwith
this.TEXT1 = new TEXT(this)
with (this.TEXT1)
height = 5.5
left = 7
top = 7.7
width = 44.3333
metric = 0
colorNormal = "DARKBLUE/WHITE"
alignVertical = 1
alignHorizontal = 1
fontName = "MS Sans Serif"
fontSize = 18
text = "Refreshing Fleet Tree. Please stand by...."
endwith
this.FLEETTREE = new TREEVIEW(this)
with (this.FLEETTREE)
onLeftDblClick = class::FLEETTREE_ONLEFTDBLCLICK
onRightMouseUp = class::FLEETTREE_ONRIGHTMOUSEUP
height = 11.8182
left = 2.1429
top = 5.3182
width = 54
metric = 0
colorNormal = "DARKBLUE/WHITE"
fontName = "MS Sans Serif"
fontSize = 8
borderStyle = 7
allowEditLabels = false
allowEditTree = false
indent = 19
trackSelect = false
toolTips = false
imageScaleToFont = true
imageSize = 16
endwith
this.CONTAINER1 = new CONTAINER(this)
with (this.CONTAINER1)
transparent = false
left = 2
top = 0.45
width = 54
height = 4.5
metric = 0
colorNormal = "WHITE"
borderStyle = 7
endwith
this.CONTAINER1.SLIDESPAN = new SLIDER(this.CONTAINER1)
with (this.CONTAINER1.SLIDESPAN)
onChange = {;this.parent.buttonRefresh.enabled := true}
height = 2
left = 3
top = 1.5
width = 20
metric = 0
colorNormal = "DARKBLUE/WHITE"
borderStyle = 3
pageno = 0
value = 2
rangeMax = 3
rangeMin = 1
vertical = false
enableSelection = false
startSelection = 2
endSelection = -1
endwith
this.CONTAINER1.TEXTSPAN = new TEXT(this.CONTAINER1)
with (this.CONTAINER1.TEXTSPAN)
height = 1
left = 1.3333
top = 2.8
width = 25
metric = 0
colorNormal = "DARKBLUE/WHITE"
fontName = "MS Sans Serif"
fontSize = 8
text = " Day Week Month"
pageno = 0
endwith
this.CONTAINER1.LABELSPAN = new TEXT(this.CONTAINER1)
with (this.CONTAINER1.LABELSPAN)
height = 1
left = 3
top = 0.4
width = 20
metric = 0
colorNormal = "DARKBLUE/WHITE"
alignVertical = 2
fontName = "MS Sans Serif"
fontSize = 8
text = "View schedule for:"
pageno = 0
endwith
this.CONTAINER1.LABELSTART = new TEXT(this.CONTAINER1)
with (this.CONTAINER1.LABELSTART)
height = 1
left = 24
top = 0.7727
width = 12
metric = 0
colorNormal = "DARKBLUE/WHITE"
alignVertical = 1
alignHorizontal = 2
fontName = "MS Sans Serif"
fontSize = 8
text = "Starting on:"
pageno = 0
endwith
this.CONTAINER1.BUTTONREFRESH = new PUSHBUTTON(this.CONTAINER1)
with (this.CONTAINER1.BUTTONREFRESH)
onClick = class::BUTTONREFRESH_ONCLICK
enabled = false
height = 1.2
left = 30
top = 2.25
width = 20
text = "Refresh Flight Tree"
metric = 0
fontName = "MS Sans Serif"
fontSize = 8
group = true
colorNormal = "BtnText/BtnFace"
pageno = 0
value = false
endwith
this.CONTAINER1.SPINSTART = new SPINBOX(this.CONTAINER1)
with (this.CONTAINER1.SPINSTART)
onChange = {; this.parent.buttonRefresh.enabled := true}
onOpen = {;this.borderStyle := 0}
height = 1
left = 37.875
top = 0.75
width = 12
metric = 0
colorHighLight = ""
rangeMax = 100
rangeMin = 1
fontName = "MS Sans Serif"
fontSize = 8
value = {01/01/98}
validRequired = true
pageno = 0
borderStyle = 7
endwith
// {Linked Method} form.container1.buttonrefresh.onClick
function BUTTONREFRESH_onClick
this.form.fleetTree.visible := false
this.form.fleetTree.releaseAllChildren()
class::growTree( this.form )
this.form.fleetTree.visible := true
this.enabled := false
return true
// {Linked Method} form.fleettree.onLeftDblClick
function FLEETTREE_onLeftDblClick(flags, col, row)
local item, bRead
item = this.selected
bRead = false
if ( item.text.subString(0,8) == "Schedule" )
if ( TYPE("this.form.app") == "O" )
bRead := this.form.app.openScheduleAsDialog( item )
endif
endif
return ( bRead )
// {Linked Method} form.fleettree.onRightMouseUp
function FLEETTREE_onRightMouseUp(flags, col, row)
local bSchedule
bSchedule = this.selected.text.subString(0,8) == "Schedule"
if ( bSchedule )
this.shortCut.left := this.left + col
this.shortCut.top := this.top + row
this.shortCut.open()
endif
return ( bSchedule )
// {Linked Method} form.open
function Form_Open
if ( TYPE("this.app") == "O" )
this.fleetTree.shortCut = new ftreePopup( this, "shortcut" )
else
this.fleetTree.onRightMouseUp := null
endif
class::growTree( this )
return FTREEFORM::Open()
function growTree( thisForm )
local rFTree
local itemAir, itemFlight, itemSc
local nItemAir, nItemFlight, nItemSc
local nFlight, sStart, sEnd, d
nFlight = null
nAircraft = null
nItemAir = 0
nItemFlight = 0
nItemSc = 0
thisForm.qFTree.requery()
rFTree = thisForm.qFtree.rowset
fFTree = rFTree.fields
d = new Date()
d.setDate( thisForm.container1.spinStart.value.getDate() )
d.setMonth( thisForm.container1.spinStart.value.getMonth() )
d.setYear( thisForm.container1.spinStart.value.getYear() )
sStart = "'" + DTOC( d ) + "'"
do case
case ( thisForm.container1.slideSpan.value == 2 ) // week
d.setDate( d.getDate() + 7 )
case ( thisForm.container1.slideSpan.value == 3 ) // month
d.setMonth( d.getMonth() + 1 )
endcase
sEnd = "'" + DTOC( d ) + "'"
rFTree.filter := '"Flight Date" >= ' + sStart + " AND " + ;
'"Flight Date" <= ' + sEnd
rFTree.first()
do while ( not rFTree.endOfSet )
if ( nAircraft <> fFTree["Aircraft ID"].value )
nAircraft := fFTree["Aircraft ID"].value
itemAir = new TreeItem( thisForm.fleetTree, ;
"A" + LTRIM(STR( nItemAir ) ) )
nItemAir++
with ( itemAir )
text := "Aircraft: " + ;
LTRIM( STR( fFTree["Aircraft ID"].value ) ) + ;
" - " + fFTree["Make"].value + ;
" " + fFTree["Model"].value
image := "FILENAME FLEET.ICO"
selectedImage := "FILENAME FLEET.ICO"
endwith
endif
if ( nFlight <> fFTree["Flight ID"].value )
nFlight := fFTree["Flight ID"].value
itemFlight = new TreeItem( itemAir, ;
"F" + LTRIM( STR( nItemFlight ) ) )
nItemFlight++
with ( itemFlight )
text := "Flight: " + LTRIM( STR( nFlight ) ) + ;
" - " + fFTree["From ID"].value + ;
" to " + fFTree["To ID"].value
image := "FILENAME FLIGHT.ICO"
selectedImage := "FILENAME FLIGHT.ICO"
endwith
endif
itemSc = new TreeItem( itemFlight, ;
"S" + LTRIM( STR( nItemSc ) ) )
nItemSc++
itemSc.sFlightDate = "'" + DTOC( fFTree["Flight Date"].value ) + "'"
itemSc.sFlightID = STR( fFTree["Flight ID"].value )
itemSc.sAircraftID = STR( fFTree["Aircraft ID"].value )
with ( itemSc )
text := "Scheduled: " + ;
fFTree["Flight Date"].value + " " + ;
fFTree["Departs"].value
image := "FILENAME CLOCK.ICO"
selectedImage := "FILENAME CLOCK.ICO"
endwith
rFTree.next()
enddo
return ( nItemAir + nItemFlight + nItemSc )
endclass